﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using VersionComparer.Configuration;
using VersionComparer.Base;

namespace VersionComparer.DataModel
{

    [ConfigurationName("actions")]
    public class ActionList : Collection<BatchAction>
    {
        private static ActionList current = Load();
        public static ActionList Current
        {
            get
            {
                return current;
            }
            set
            {
                current = value;
            }
        }
        public bool Save()
        {
            return Configuration.ConfigurationHelper.Save( this);
        }
        public void Set(List<BatchAction> actionList)
        {
            Clear();
            foreach (BatchAction action in actionList)
                ActionList.Current.Add(action);
            Save();
        }
        public static ActionList Load()
        {

            return Configuration.ConfigurationHelper.Load < ActionList>(); 
        }
    }
}
